from sqlalchemy import Column, DateTime, Integer, String, SmallInteger
from apps.models.base import Base

class UserBind(Base):
    __tablename__ = 'user_bind'

    id = Column(Integer, autoincrement=True, primary_key=True)
    user_id = Column(Integer, nullable=False)
    client_type = Column(String(50))
    openid = Column(String(100), nullable=False)
    update_time = Column(Integer, nullable=False)
    create_time = Column(Integer, nullable=False)
    status = Column(SmallInteger, nullable=False, default=1)

    # 指明需要序列化的属性
    def keys(self):
        return ['id', 'user_id', 'openid', 'update_time']